package 周赛;

import java.util.Arrays;

public class 摧毁小行星 {
    public boolean asteroidsDestroyed(int mass, int[] asteroids) {
        Arrays.sort(asteroids);
        long num = mass;
        for (int i = 0; i < asteroids.length; i++) {
            if (num>=asteroids[i])
                num+=asteroids[i];
            else
                return false;
        }
        return true;
    }
}
